minecraftmodcustomstufffandomcom-20200215-history
Chest
Chests are a staple block type in Minecraft used for holding large quantities of items. Using Custom Stuff, you can create chests or containers that have different attributes such as increased durability or an interesting look. Example Chest (CS2) mod.js config.addBlockIdProperty("cobaltChestID", 2501); mod.addGui("cobaltChestGUI.js", "chest"); mod.addTileEntity("cobaltChestTE.js", "chest"); mod.addBlock("cobaltChest.js", "chest"); blocks/cobaltChest.js id = config.getBlockId("cobaltChestID"); name = "cobaltChest"; material = "iron"; stepSound = "metal"; creativeTab = "buildingBlocks"; modelTexture = "cobaltChest.png"; displayName0 = "Cobalt Chest"; hasTileEntity0 = true; tileEntity0 = "cobaltChestTE"; hardness0 = 2; resistance0 = 30; addToCreative0 = true; onActivated0 = "player.openGui('cobaltChestGUI', position); result = true;"; guis/cobaltChestGUI.js name = "cobaltChestGUI"; guiFile = "cobaltChestGUI.png"; chestX = 8; chestY = 18; inventoryX = 8; inventoryY = 122; height = 176; width = 204; tileEntities/cobaltChestTE.js name = "cobaltChestTE"; colLength = 5; rowLength = 9; Chest Block Attributes Required Attributes * displayName * id * name * modelTexture Optional Attributes * addToCreative * canPlaceOnCeiling * canPlaceOnFloor * canPlaceOnWall * canSilkHarvest * creativeTab * drop * fireSpreadSpeed * flammability * fortuneModifier * hardness * harvestLevel * hasCollision * hasTileEntity * isBeaconBase * isBurning * isFireSource * isWood * light * material * opacity * pick * resistance * semiTransparent * slipperiness * stepSound * tickrate * tileEntity * tileTransparent * toolClass * transparent modelTexture This is the file that determines what your chest looks like in the players inventory, after being placed, and when it opens. The layout for this file is the same as the vanilla chest's texture file. Presently (Custom Stuff 2.2.3), Custom Chests still use the old-style look that is the same size as a regular block and does not open and close when used. Likewise, custom chests make no sounds upon activation. Unlike crafting benches, where you have to script a GUI onto an ordinary block, the ability of a chest to store items is linked to the block type, so there's no scripting required. On the other hand, this same behavior also prevents rightclicked triggers from being used. Because chests use their damage value information to track the direction they're facing, you cannot use that attribute to make variations. Example Chest Block - Iron Chest Here's an example of a chest make with higher resistance and hardness than a standard chest: name="Iron Chest"; id=125; texturefile="customstuff.png"; textureindex=15; type="chest"; material="iron"; stepsound="metal"; hardness=10; resistance=30; iddropped=125; chesttextureindex1=15; chesttextureindex2=31; chesttextureindex3=14; chesttextureindex4=12; chesttextureindex5=13; chesttextureindex6=28; chesttextureindex7=29; toolclass="pickaxe"; harvestlevel=0; Chest Block Attributes Below is a table of attributes available to chest-type blocks, including information on notable attributes. type This must be set to 'chest' in order for the block to function as a container. chesttextureindex These are seven attributes (chesttextureindex1, chesttextureindex2, etc) that govern which texture will appear on each side of the chest both in its single and double form. This attribute is used because unlike most blocks, chests do have distinct fronts and backs. textureindex If you use all seven of the chesttextureindex attributes, this attribute is effectively worthless since those attributes will texture 'over' this attribute on every side. This is why, unlike for almost every other block type, it's an optional attribute. iddropped / quantitydropped / damagedropped In addition to what the chest dropps when it is broken, it will also always drop its contents. Note: Unlike Slabs, you do not have to set up a series of attributes and a separate block to handle double chests. Chest Blocks will always attach to create double chests when two of the same chest blocks are placed next to one another. Category:Block Types Category:Examples